﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraSplashScreen;
using DevExpress.XtraEditors;

namespace HouseSecretary
{
    public partial class SplashScreenInitForm : SplashScreen
    {
        public SplashScreenInitForm()
        {
            InitializeComponent();
        }

        #region Overrides

        public override void ProcessCommand(Enum cmd, object arg)
        {
            base.ProcessCommand(cmd, arg);
            SplashScreenCommand command = (SplashScreenCommand)cmd;
            if (command == SplashScreenCommand.SetMessage)
            {
                string message = (string)arg;
                lblInitMsg.Text = message;
            }
        }
        #endregion

        public enum SplashScreenCommand
        {
            SetMessage
        }

        private void SplashScreenInitForm_Load(object sender, EventArgs e)
        {
            Resources.ResImageList resImgList = new Resources.ResImageList();
            picImage.Image = resImgList.SplashImage[0];
            //获取程序最后一次编译日期
            DateTime AppLastDate = System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location);

            lblCopyMsg.Text = "易灵软件(C)2002-" + AppLastDate.Year;
            lblWebAddress.Text = "网址：http://www.elingsoft.com";
            lblVersion.Text = "版本：" + Base.GlobalParams.GLOBAL_VERSION;
        }


        private void picImage_Paint(object sender, PaintEventArgs e)
        {
            foreach (Control C in this.Controls)
            {
                if (C is LabelControl)
                {

                    LabelControl L = (LabelControl)C;
                    if (L.Name == "lblVersion" || L.Name == "lblCopyMsg" || L.Name == "lblWebAddress")
                    {
                        L.Visible = false;
                        e.Graphics.DrawString(L.Text, L.Font, new
              SolidBrush(L.ForeColor), L.Left - picImage.Left, L.Top - picImage.Top);
                    }
                }
            }
        }
        protected override void OnClosed(EventArgs e)
        {
            picImage.Image = null;
            picImage = null;
        }

    }
}